//路由层

//导入控制器层
const routesController = require(baseName + '/routesController/routesController.js')

module.exports = (app) => {

    app.get('/', (req, res) => {
        res.send('this is home page')
    })

    app.post('/register', routesController.register)
    app.post('/postcode', routesController.postEmailCode)
    app.post('/login', routesController.login)

    //处理404
    app.use((req, res) => {
        res.status(404).send('网络开了点小差，暂时找不到资源！')
    })

    //处理500
    app.use((err, req, res) => {
        if (err) {
            res.status(500).send('服务端出了问题！')
        }

    })
}